import { baseUrl, billBaseUrl } from "@/utils/config.js"
const placeholderStyle = 'color:#ccc;font-size:28rpx;font-weight: bold;'
const displayStyle = 'display: flex;align-items: center;justify-content: center;'
const inputStyle = {
  fontSize: '28rpx',
  textAlign: 'right',
  fontWeight: 'bold'
}
const rightTextStyle = 'border: 0rpx solid #02a074;height: 40rpx;flex-shrink: 0;width: 72rpx;margin-left: 40rpx;color: #666666;display: flex;justify-content: center;align-items: center'
const rightStyle = 'width: 44rpx;height: 70rpx;display: flex;justify-content: flex-end;align-items: center;'
const constructionModel = {
  title: '机械施工结算单',
  type: 'construction',
  rules: {
    'extend.name': [{
      required: true,
      message: '请填写工程名称',
      trigger: ['change', 'blur']
    }],
    receivableAmount: [{
      required: true,
      message: '请填写应收金额',
      trigger: ['change', 'blur']
    }],
    'faultRecord.reportPerson': [{
      required: true,
      message: '请填写合计时间',
      trigger: ['change', 'blur']
    }],
  },
  data: [
  [
    {
      key: 'extend',
      subKey: 'name',
      type: 'input',
      inputType: 'text',
      label: '工程名称',
      placeholder: '填写工程名称',
      customStyle: inputStyle,
      placeholderStyle: placeholderStyle,
      required: true,
      height: 70,
      clearable: false,
      borderBottom: true,
      right: null,
    },
  ],   [
    {
      key: 'expenseDetails',
      type: 'expenseDetails',
      label: '收据明细',
      ref: 'particulars-create'
    }
  ],[
    {
      key: 'faultRecord',
      subKey: 'reportPerson',
      type: 'input',
      inputType: 'digit',
      label: '合计时间',
      placeholder: '请填写合计时间',
      customStyle: inputStyle,
      placeholderStyle: placeholderStyle,
      required:  true,
      height: 70,
      clearable: false,
      borderBottom: false,
      right: {
        style: rightTextStyle,
        label: '小时',
      },
    },
    {
      type: 'money',
      placeholderStyle: 'color:#ccc;font-size:28rpx;font-weight: bold;',
      customStyle: {
        fontSize: '28rpx',
        textAlign: 'right',
        fontWeight: 'bold'
      },
      labels: {
        receivableAmount: '应收金额',
        actualAmount: '实收金额',
        resultAmount: '欠款金额',
      }
    }
  ], [
    {
      key: 'address',
      type: 'input',
      inputType: 'text',
      label: '施工单位',
      placeholder: '请填写施工单位',
      customStyle: inputStyle,
      placeholderStyle: placeholderStyle,
      required: false,
      height: 70,
      clearable: false,
      borderBottom: false,
      right: null,
    },
    {
      key: 'faultRecord',
      subKey: 'symptom',
      type: 'input',
      inputType: 'text',
      label: '车牌号',
      placeholder: '请填写车牌号码',
      customStyle: inputStyle,
      placeholderStyle: placeholderStyle,
      required: false,
      height: 70,
      clearable: false,
      borderBottom: false,
      right: null,
    },
    {
      key: 'faultRecord',
      subKey: 'repairResult',
      type: 'input',
      inputType: 'normal',
      label: '司机',
      placeholder: '请填写司机',
      customStyle: inputStyle,
      placeholderStyle: placeholderStyle,
      required: false,
      height: 70,
      clearable: false,
      borderBottom: false,
      right: null,
    },
    {
      key: 'faultRecord',
      subKey: 'machineModel',
      type: 'input',
      inputType: 'normal',
      label: '机型',
      placeholder: '请填写机型',
      customStyle: inputStyle,
      placeholderStyle: placeholderStyle,
      required: false,
      height: 70,
      clearable: false,
      borderBottom: false,
      right: null,
    },
  ], [
    {
      key: 'timeInfo',
      type: 'time',
      label: '服务时间',
      borderBottom: true,
      list: [{
        key: 'day',
        img: baseUrl + 'riqi@3x.png',
        placeholder: '选择服务日期',
        func: 'handleClickDate',
        ref: {
          key: 'timeInfo',
          subKey: 'day',
          type: 'date',
          show: false,
          ref: 'day',
        }
      }, {
        key: 'time',
        img: baseUrl + 'shijian@3x.png',
        placeholder: '选择时间',
        func: 'handleClickTime',
        ref: {
          key: 'timeInfo',
          subKey: 'time',
          type: 'time',
          show: false,
        }
      }]
    },
    {
      key: 'faultRecord',
      subKey: 'category',
      type: 'select',
      label: '天气',
      labels: ['晴', '阴', '雨天', '雪天'],
      func: 'selectType',
      borderBottom: true,
    },
    {
      key: 'remark',
      type: 'textarea',
      inputType: 'maintain-remark',
      label: '备注信息',
      placeholder: '举例：本确认单须由施工班组当日办理手续，逾期无效。',
      style: 'min-height: 240rpx;',
      func: 'editRemark',
	  right: {
	    label: '选模板',
	    func: 'chooseRemark'
	  }
    }
  ], [
    {
      key: 'extend',
      subKey: 'customerSignSwitch',
      type: 'switch',
      label: '是否需要客户签字',
      func: 'handleChangeShowSign',
    }
  ], [
    {
      key: 'extend',
      type: 'seal',
    }
  ]],
  sealInfos: [
    {
      label: "水印",
      selectText: '选择电子水印',
      url: '',
      selected: true,
      value: '1',
      code: 'ELECTRON',
      width: 148,
    },
    {
      label: "公章",
      selectText: '选择公章',
      url: '',
      selected: false,
      value: '2',
      code: 'OFFICIAL',
      width: 148,
    },
    {
      label: "私章",
      selectText: '选择私章',
      url: '',
      selected: false,
      value: '4',
      code: 'PERSON',
      width: 148,
    },
    {
      label: "不使用",
      url: '',
      selected: false,
      value: '3',
      code: '',
      width: 148,
    }
  ],
  initFormFunc: (form) => {
    form.actualAmount = 0
  },
  changeFormFunc: (val)=> {
    let form = JSON.parse(JSON.stringify(val))
    form.repairTime = form.timeInfo.day + ' ' + form.timeInfo.time
    return form
  },
  setFormFunc: (form)=> {
  }
}

export default constructionModel